<%@ page language="java" contentType="text/html; utf-8"  pageEncoding="utf-8"%>
<%@ page import="org.apache.ibatis.io.Resources"%>
<%@ page import=" org.apache.ibatis.session.SqlSession"%>
<%@ page import="org.apache.ibatis.session.SqlSessionFactory"%>
<%@ page import="org.apache.ibatis.session.SqlSessionFactoryBuilder"%>
<%@ page import="java.io.Reader"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="com.zzty.entity.Library"%>
<%
    Reader reader = null;
	reader = Resources.getResourceAsReader("Configuration.xml");
	SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(reader);
	SqlSession se = sessionFactory.openSession();
	Library L;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>书单列表</title>
</head>
<body align="center">
<h2>书单列表</h2>
	<table border=1 align="center">
		<tr>
			<th>书名</th>
			<th>价格</th>
			<th>编辑</th>
		</tr>
		<%
			List<Library> list = new ArrayList<Library>();
			list = se.selectList("com.zzty.selectBook");
			for (Library lib : list) {
		%>
		<tr>
			<td><%=lib.getName()%></td>
			<td><%=lib.getPrice()%></td>
			<td>
			<form action = "DeleteBookController">
			<input type="hidden" name="id" value="<%=lib.getId() %>">
			<input type = "submit" value = "删除">
			</form></td>
			
			<!-- <button><a href="updateBook.jsp">修改</a> </button>  -->
			</form>
		</tr>
		<%
			}
		%>
	</table><br>
	<button><a href="addBook.html">增加书籍</a> </button>      
</body>
</html>